import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, ManyToOne, JoinColumn } from 'typeorm';
import { DiscussionPost } from './discussion-post.entity';
import { ApartmentUser } from '../../apartment-user/entities/apartment-user.entity';

@Entity()
export class Comment {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column('text')
  content: string;

  @ManyToOne(() => ApartmentUser, { eager: true })
  @JoinColumn({ name: 'authorId' })
  author: ApartmentUser;

  @Column()
  authorId: string;

  @ManyToOne(() => DiscussionPost, post => post.comments)
  @JoinColumn({ name: 'postId' })
  post: DiscussionPost;

  @Column()
  postId: string;

  @CreateDateColumn()
  createdAt: Date;
} 